﻿#if !LITE
using System;
using System.Collections.Generic;
using System.Text;

using Elegant.Ui;

namespace iPdf
{
    class ConvertPage : TataRibbonPage
    {
        #region Properties

        protected override PageOption PageOption
        {
            get
            {
                ConvertOption option = new ConvertOption();
                option.Format = this.FormatGallery.SelectedFormat;
                return option;
            }
        }

        public override bool SessionEnabled
        {
            get
            {
                return false;
            }
        }

        public override bool PrinterDependent
        {
            get
            {
                return true;
            }
        }

        public override bool ReadyToAct
        {
            get
            {
                return base.ReadyToAct && this.FormatGallery.SelectedItem != null;
            }
        }
        #endregion

        public ConvertPage()
        {
            visibleColumns.Add(TataGrid.Destination);
        }

        protected override ActionItem GetIthActionItem(TataGrid grid, int i)
        {
            ConvertItem item = new ConvertItem();
            item.Source = (string)grid.GetColumnValueAtRow(i, TataGrid.Source);
            item.Destination = (string)grid.GetColumnValueAtRow(i, TataGrid.Destination);
            item.Bookmark = IsColumnVisible(TataGrid.Bookmark) ?
                (bool)grid.GetColumnValueAtRow(i, TataGrid.Bookmark) : false;
            item.Hyperlink = IsColumnVisible(TataGrid.Hyperlink) ?
                (bool)grid.GetColumnValueAtRow(i, TataGrid.Hyperlink) : false;
            item.Navigator = IsColumnVisible(TataGrid.Navigator) ?
                (bool)grid.GetColumnValueAtRow(i, TataGrid.Navigator) : false;

            return item;
        }

        protected override void InitializeComponent()
        {
            base.InitializeComponent();

            this.FormatGroup = new Elegant.Ui.RibbonGroup();
            this.FormatGallery = new FormatGallery(SourceFormat == FileFormat.PdfFormat);
            ((System.ComponentModel.ISupportInitialize)(this.FormatGroup)).BeginInit();
            this.FormatGroup.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.FormatGallery)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.FormatGallery.Popup)).BeginInit();
            this.SuspendLayout();

            this.Controls.Add(this.FormatGroup);
            // 
            // FormatGroup
            // 
            this.FormatGroup.Controls.Add(this.FormatGallery);
            this.FormatGroup.DialogLauncherButtonVisible = false;
            this.FormatGroup.Id = "5820d54c-8e16-4f2e-9181-d30006621001";
            this.FormatGroup.LargeImages.Images.AddRange(new Elegant.Ui.ControlImage[] {
            new Elegant.Ui.ControlImage("Normal", global::iPdf.Properties.Resources.Format)});
            this.FormatGroup.Location = new System.Drawing.Point(4, 3);
            this.FormatGroup.Name = "FormatGroup";
            this.FormatGroup.Size = new System.Drawing.Size(28, 94);
            this.FormatGroup.SmallImages.Images.AddRange(new Elegant.Ui.ControlImage[] {
            new Elegant.Ui.ControlImage("Normal", global::iPdf.Properties.Resources.Format16)});
            this.FormatGroup.TabIndex = 0;
            this.FormatGroup.Text = "Format";
            // 
            // FormatGallery
            // 
            this.FormatGallery.Id = "46b2c46d-109b-4615-8770-749cb02835da";
            this.FormatGallery.Location = new System.Drawing.Point(4, 5);
            this.FormatGallery.Name = "FormatGallery";
            // 
            // 
            // 
            this.FormatGallery.PopupMinimumItemsInRowCount = 3;
            this.FormatGallery.ExpandButtonVisible = false;
            this.FormatGallery.Size = new System.Drawing.Size(19, 66);
            this.FormatGallery.TabIndex = 0;
            this.FormatGallery.Text = "FormatGallery";

            ((System.ComponentModel.ISupportInitialize)(this.FormatGroup)).EndInit();
            this.FormatGroup.ResumeLayout(false);
            this.FormatGroup.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.FormatGallery.Popup)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.FormatGallery)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        protected RibbonGroup FormatGroup;
        protected FormatGallery FormatGallery;
    }
}

#endif